package ua.kratik.seabattle.dao;

import java.util.List;

public interface BasicDAO<D extends DataObject> {
	
	void add(D dto);
	
	void addAll(List<D> dtos);
	
	void remove(D dto);
	
	void removeById(Integer id);
	
	void removeAll(List<D> dtos);
	
	/**
	 * Return the persistent instance of the given id, or null if there 
	 * is no such persistent instance.
	 * @param id
	 * @return the persistent instance of the given id, or null if there 
	 * 			is no such persistent instance 
	 */
	D findById(Integer id);
	
	List<D> findAll();
	
	void update(D dto);
	
	/**
	 *  Refresh the state of the instance from the database, 
	 *  overwriting changes made to the entity, if any.
	 *  @param dto instance to be refreshed
	 */
	void refresh(D dto);
}
